Xenoprof notifies guest kernel via VIRQ_XENOPROF when sampled.
But it does coarsly based on heuristic so that sometimes VIRQ_XENOPROF
isn't delivered resulting in that oprofile daemon collects no sample.
To avoid that situation, always send VIRQ_XENOPROF when sampling is
stopped.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
#ifndef COMPAT
#include <xen/guest_access.h>
#include <xen/sched.h>
+#include <xen/event.h>
#include <public/xenoprof.h>
#include <xen/paging.h>
#include <xsm/xsm.h>
break;
case XENOPROF_stop:
+ {
+ struct domain *d;
+ struct vcpu *v;
+ int i;
+
if ( xenoprof_state != XENOPROF_PROFILING )
{
ret = -EPERM;
break;
}
xenoprof_arch_stop();
+
+ /* Flush remaining samples. */
+ for ( i = 0; i < adomains; i++ )
+ {
+ if ( !active_ready[i] )
+ continue;
+ d = active_domains[i];
+ for_each_vcpu(d, v)
+ send_guest_vcpu_virq(v, VIRQ_XENOPROF);
+ }
xenoprof_state = XENOPROF_READY;
break;
+ }
case XENOPROF_disable_virq:
{